public List<AnnObject> ToAnnObject(DicomDataSet ds,List<DicomAnnotationObject> dicomAnnotationObjectList)
ds
A Leadtools.Dicom.DicomDataSet that contains the Graphic Group Sequence (0070,0234).
dicomAnnotationObjectList
The a list of list of Leadtools.Dicom.DicomAnnotationObject to be converted.
A list of Leadtools.Annotations.Engine.AnnObject
This function converts a list of DICOM Annotation Objects (text, graphic, and compound graphic) Leadtools.Dicom.DicomAnnotationObject into a list of LEAD annotation objects (Leadtools.Annotations.Engine.AnnObject).
Note that dicomAnnotationObjectList can contain Leadtools.Dicom.DicomAnnotationObject that are grouped together, to return a single Leadtools.Annotations.Engine.AnnObject.
For example, the Leadtools.Annotations.Engine.AnnPolyRulerObject, Leadtools.Annotations.Engine.AnnProtractorObject, and the Leadtools.Annotations.Engine.AnnCrossProductObject are all stored as one or more 'grouped' Leadtools.Dicom.DicomCompoundGraphic objects.
This example does the following:
using Leadtools;using Leadtools.Dicom;using Leadtools.Dicom.Annotations;using Leadtools.Annotations;using Leadtools.Annotations.Engine;private List<AnnObject> DicomAnnotationsUtilities_ToAnnObject2(){// Set up the DicomAnnotationsUtilities converterDicomAnnotationsUtilities du = new DicomAnnotationsUtilities();du.ImageDpiX = 96.0;du.ImageDpiY = 96.0;du.DisplayWidth = 200;du.DisplayHeight = 200;du.LayerName = "Layer 0";du.CompoundGraphicInstanceId = 100;du.GraphicGroupId = 123;// LineStyle -- user for both rulersDicomLineStyle lineStyle = new DicomLineStyle();lineStyle = new DicomLineStyle();lineStyle.LineOptions = DicomAnnotationLineOptions.None;lineStyle.Shadow.ShadowStyle = DicomAnnotationShadowStyleType.Off;lineStyle.Shadow.ShadowOpacity = 0.0f;lineStyle.Shadow.ShadowOffsetX = 0.0f;lineStyle.Shadow.ShadowOffsetY = 0.0f;lineStyle.Shadow.ShadowColorCieLabValue = new ushort[3] { 1, 2, 3 };lineStyle.PatternOnColorCieLabValue = new ushort[3] { 24886, 53484, 50171 }; // redlineStyle.PatternOffColorCieLabValue = new ushort[3] { 0, 0, 0 };lineStyle.LineThickness = 2.0f;lineStyle.LineDashingStyle = DicomAnnotationDashStyleType.Solid;lineStyle.LinePattern = 0xFFFF;lineStyle.PatternOnOpacity = 1.0f;lineStyle.PatternOffOpacity = 0.0f;// Create a compound graphic -- ruler0DicomCompoundGraphic ruler0 = new DicomCompoundGraphic();ruler0.LayerName = "Layer 0";ruler0.Units = DicomAnnotationUnitsRelativityType.Pixel;ruler0.Type = DicomAnnotationCompoundGraphicType.Ruler;DicomAnnotationPoint[] pts = new DicomAnnotationPoint[2];pts[0] = new DicomAnnotationPoint(100, 100);pts[1] = new DicomAnnotationPoint(200, 200);ruler0.SetAnnotationPoints(pts, pts.Length);ruler0.CompoundGraphicInstanceId = du.IncrementCompoundGraphicInstanceId();ruler0.GraphicGroupId = du.GraphicGroupId;ruler0.Options = DicomAnnotationOptions.CompoundGraphicInstanceId | DicomAnnotationOptions.GraphicGroupId;ruler0.LineStyle = lineStyle.Clone();// Create a compound graphic -- ruler0DicomCompoundGraphic ruler1 = new DicomCompoundGraphic();ruler1.LayerName = "Layer 0";ruler1.Units = DicomAnnotationUnitsRelativityType.Pixel;ruler1.Type = DicomAnnotationCompoundGraphicType.Ruler;pts = new DicomAnnotationPoint[2];pts[0] = new DicomAnnotationPoint(200, 200);pts[1] = new DicomAnnotationPoint(300, 100);ruler1.SetAnnotationPoints(pts, pts.Length);ruler1.CompoundGraphicInstanceId = du.IncrementCompoundGraphicInstanceId();ruler1.GraphicGroupId = du.GraphicGroupId;ruler1.Options = DicomAnnotationOptions.CompoundGraphicInstanceId | DicomAnnotationOptions.GraphicGroupId;ruler1.LineStyle = lineStyle.Clone();// Convert the DICOM Annotation to a LEAD annotationList<DicomAnnotationObject> listDicomObjects = new List<DicomAnnotationObject>();listDicomObjects.Add(ruler0);listDicomObjects.Add(ruler1);// Create the DicomDataSet that has the GraphicGroupSequenceDicomDataSet dsPre = new DicomDataSet();DicomElement graphicGroupSequenceElement = dsPre.InsertElement(null, false, DicomTag.GraphicGroupSequence, DicomVRType.SQ, true, 0);DicomElement item = dsPre.InsertElement(graphicGroupSequenceElement, true, DicomTag.Item, DicomVRType.SQ, true, 0);dsPre.InsertElementAndSetValue(item, true, DicomTag.GraphicGroupLabel, "PolyRulerObject");dsPre.InsertElementAndSetValue(item, true, DicomTag.GraphicLayerDescription, "LEAD Annotation");dsPre.InsertElementAndSetValue(item, true, DicomTag.GraphicGroupID, du.GraphicGroupId);List<AnnObject> annObjectList = du.ToAnnObject(dsPre, listDicomObjects);return annObjectList;}